package br.ufrj.dcc.dm.model.decisionTree;

import java.util.ArrayList;
import java.util.List;

import br.ufrj.dcc.dm.model.Attribute;

public class Node 
{
	private int attributeIndex;
	
	private List<Decision> decisions = new ArrayList<Decision>();
	
	public Node(List<Decision> decisions, int attributeIndex) 
	{
		this.decisions = decisions;
		this.attributeIndex = attributeIndex;
	}
	
	public Node() {}
	
	public Node decide(String value)
	{
		for(Decision decision : decisions)
		{
			if(decision.getValue().equals(value))
			{
				return decision.getDecidedNode();
			}
		}
		
		return null;
	}

	public List<Decision> getDecisions() 
	{
		return decisions;
	}
	
	public void setDecisions(List<Decision> decisions) 
	{
		this.decisions = decisions;
	}

	public int getAttributeIndex()
	{
		return attributeIndex;
	}

	public void setAttributeIndex(int attributeIndex)
	{
		this.attributeIndex = attributeIndex;
	}
	
}